import { utils } from 'hi-ui';
import { createTempOrderNo, currentUserID } from "@/utils/common.js";
export default {
    id: "WithdrawEntity_enterpriseid",
    returnTotal: true,
    modelFile: "finance/withdraw/dataset/WithdrawEntity_enterpriseid.xml",
    sortFields: [
        "record_id",
        "record_status",
        "create_by",
        "create_date",
        "update_by",
        "update_date",
        "apply_no",
        "payee_no",
        "apply_money",
        "bank_name",
        "bank_account",
        "bank_addr",
        "payee_name",
        "payment_account",
        "rreality_money",
        "fee",
        "currency_type",
        "finish_date",
        "FAUDIT",
        "user_type",
        "shop_id",
        "shop_desc",
        "apply_name",
        "payee_account",
        "lock_trans_code"
    ],
    //字段元素
    element: {
        eleNumber: {
            field: "apply_no"
        }
    },
    fields: {
        record_id: {
            name: "record_id", //字段ID
            label: "ID", //字段描述
            dbtype: "dbString", //数据类型
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return (new Date()).valueOf();
                },
            },
        },
        apply_no: {
            name: "apply_no", //字段ID
            label: "单号", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            readonly: true,
            length: 25,
            default: {
                //默认值
                //rule: 'first', //prior   填充规则
                exps: (data) => {
                    //填充表达式
                    return createTempOrderNo();
                },
            },
        },

        record_status: {
            name: "record_status", //字段ID
            label: "状态", //字段描述
            dbtype: "dbInt", //数据类型
        },

        create_by: {
            name: "create_by", //字段ID
            label: "创建人", //字段描述
            dbtype: "dbString", //数据类型
        },


        create_date: {
            name: "create_date", //字段ID
            label: "创建时间", //字段描述
            dbtype: "dbDate", //数据类型
            required: true,
            readonly: true,
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return utils.date.format(new Date(), "yyyy-MM-dd HH:mm:ss");
                },
            },

        },

        update_by: {
            name: "update_by", //字段ID
            label: "更新人", //字段描述
            dbtype: "dbString", //数据类型
        },
        update_date: {
            name: "update_date", //字段ID
            label: "更新时间", //字段描述
            dbtype: "dbDate", //数据类型
        },



        payee_no: {
            name: "payee_no", //字段ID
            label: "申请人编号", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            readonly: true,
            length: 25,
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return currentUserID();
                },
            },

        },
        bank_name: {
            name: "bank_name", //字段ID
            label: "银行名称", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,

        },
        bank_account: {
            name: "bank_account", //字段ID
            label: "银行帐号", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,

        },
        bank_addr: {
            name: "bank_addr", //字段ID
            label: "银行地址", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,

        },
        payee_name: {
            name: "payee_name", //字段ID
            label: "收款人姓名", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,

        },
        payment_account: {
            name: "payment_account", //字段ID
            label: "支付帐号", //字段描述
            dbtype: "dbString", //数据类型
        },

        apply_money: {
            name: "apply_money", //字段ID
            label: "申请金额/分", //字段描述
            dbtype: "dbInt", //数据类型
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return data.apply_money_yuan * 100
                },
            },
        },

        apply_money_yuan: {
            name: "apply_money_yuan", //字段ID
            label: "申请金额", //字段描述
            dbtype: "dbFloat", //数据类型
            required: true,
            fireTarget: ["apply_money", "fee", "fee_yuan", "rreality_money"]
        },
        fee: {
            name: "fee", //字段ID
            label: "手续费/分", //字段描述
            dbtype: "dbInt", //数据类型
            readonly: true,
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return data.apply_money_yuan * 0.012 * 100
                },
            },
        },
        fee_yuan: {
            name: "fee_yuan", //字段ID
            label: "手续费", //字段描述
            dbtype: "dbFloat", //数据类型
            readonly: true,
            // fireTarget: ["fee",],
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return data.apply_money_yuan * 0.012
                },
            },
        },
        rreality_money: {
            name: "rreality_money", //字段ID
            label: "实际金额/分", //字段描述
            dbtype: "dbInt", //数据类型
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return (data.apply_money_yuan - (data.apply_money_yuan * 0.012)) * 100
                },
            },
        },

        currency_type: {
            name: "currency_type", //字段ID
            label: "货币类型", //字段描述
            dbtype: "dbString", //数据类型


        },
        user_type: {
            name: "user_type", //字段ID
            label: "提现用户类型", //字段描述
            dbtype: "dbString", //数据类型
            default: {
                exps: (data) => {
                    return '门店';
                },
            }
        },
        finish_date: {
            name: "finish_date", //字段ID
            label: "完成时间", //字段描述
            dbtype: "dbDate", //数据类型


        },
        FAUDIT: {
            name: "FAUDIT", //字段ID
            label: "审核", //字段描述
            dbtype: "dbInt", //数据类型

        },
        shop_desc: {
            name: "shop_desc", //字段ID
            label: "店铺名称", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
        },
        shop_id: {
            name: "shop_id", //字段ID
            label: "店铺id", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
        },
        apply_name: {
            name: "apply_name", //字段ID
            label: "申请人姓名", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
        },
        payee_account: {
            name: "payee_account", //字段ID
            label: "提款人资金账户", //字段描述
            dbtype: "dbString", //数据类型
        },
        lock_trans_code: {
            name: "lock_trans_code", //字段ID
            label: "锁定交易流水号", //字段描述
            dbtype: "dbString", //数据类型
        },
    }

}